<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

namespace Home\Controller;
use OT\DataDictionary;

/**
 * 前台首页控制器
 * 主要获取首页聚合数据
 */
class SearchController extends HomeController {

	//系统首页
    public function index(){


        // redirect(U('Weibo/Index/index'));
        $category = D('Category')->getTree();
        $lists    = D('Document')->lists(null);
        $this->assign('category',$category);//栏目
        $this->assign('lists',$lists);//列表
        $this->assign('page',D('Document')->page);//分页
        $this->display();
    }

    public function search(){

        $keyword = I('txtkeyWord');
        $map['title'] = array('like', "%$keyword%");
        $map['status'] = '1';
        $news = D('Document')->where($map)->select();


        $info['title'] = '"'.$keyword.'"'.'的搜索结果' ; 
        $info['description'] = $keyword.'的搜索结果' ;

        $this->assign('keyword',$keyword);
        $this->assign('info',$info);
        $this->assign('news',$news);

       // dump($news);
        $this->display();
}

}